Previous Next

Get the items for a given recommendation

get
/resources/v1/aggregates/{siteName}/engage/recommendation/{recommendationName}/items
The resource endpoint returns the aggregated results for a given recommendation asset belonging to a given site name.

Important Note: It is a Collection Resource. All the recommended assets for the given recommendation name are available in an items array in the response. Each result is again an aggregated asset. So all the aggregate asset query params (assetDepth, expand, fields) are also applicable to this resource. These aggregate asset query params are applied to each result in the items array. To know more about aggregate asset query params, refer to Asset Resource end point.

The following tables summarize the client request.

Path Parameters
Name Description Format
recommendationName Name of the recommendation string
siteName Name of the site string
Query Parameters
Name Description Format
assetDepth To know about this parameter, refer to the 'assetDepth' query param in Asset Resource end point. Applicable to each result in the items array. number
expand Accepts a comma-separated list of assetTypes. To know more about this parameter, refer to the 'expand' query param in Asset Resource end point. Applicable to each result in the items array. string
fields To know about this parameter, refer to the 'fields' query param in Asset Resource end point. Applicable to each result in the items array. string
limit Specify the total number of items to be returned. number
links Accepts a comma-separated list of link names. By default, this parameter gives all the links (next, prev, first, last, schema, self, and canonical resources). string
offset Specify the starting index from where the results will be returned. number
profileName SitesVisitorService profile name based on which recommendations are evaluated string
segments Accepts comma-separated segment names based on which recommendations are evaluated. string
totalResults Accepts a Boolean value. Setting it to true displays the total results field in the response. The default is false. boolean
visitorid Visitor ID based on which recommendations are evaluated number

The following tables summarize the server response.

Supported Media Types
  • application/json

200 Response

Recommendation asset results in aggregated format

Example 1

The following example shows how to get the first 3 recommended AVIArticle names with default segments in the Running Recommendation in the avisports sample site in WebCenter Sites, by submitting a GET request on the REST resource using cURL.

The REST URL also specifies to give only the describedby link.

Query param details:

  • "limit=3": First 3 results. Since 'offset' is not given, the default is 0.

  • "assetDepth=0&fields=name&expand=AVIArticle": All recommendation assets (AVIArticles) are available in an 'items' array. Each item (AVIArticle) is an aggregated asset, and so it is the root asset for that item. We are interested only in the name of that root asset, AVIArticle.

  • "links=describedby": Show only the describedby link.

curl -i -H "Accept: application/json" -X GET "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/engage/recommendation/Running%20Recommendation/items?limit=3&assetDepth=0&fields=name&expand=AVIArticle&links=describedby"

Example 1 Response Header

The following example shows the response header.

<Response header>HTTP/1.1 200 OK
ETag: "55c120a176afb1d146809c4cbc6e28d0d5ed5272622addc139c0a4e6e9630048" 
Cache-Control: max-age=0
Content-Type: application/json;charset=utf-8

Example 1 Response Body

The following example shows the contents of the response body, in JSON format.

{
  "offset": 0,
  "limit": 8,
  "count": 3,
  "hasMore": true,
  "links": [
	{
      "href": "http://<host>:<port>/<context>/REST/resources/v1/metadata-catalog/aggregates/avisports/engage/recommendation/Running%20Recommendation/items",
      "rel": "describedby",
      "templated": false,
      "mediaType": "application/schema+json",
      "method": "GET",
      "profile": ""
    }
  ],
  "items": [
    {
      "metadata": {
        "confidence": 100,
        "rating": 50
      },
      "start": "AVIArticle:1363104090649",
      "AVIArticle:1363104090649": {
        "name": "How Fast Should Beginners Run",
        "parents": [
          {
            "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351718403",
            "rel": "assetReference",
            "templated": false,
            "mediaType": "",
            "method": "GET",
            "profile": ""
          }
        ]
      }
    },
    {
      "AVIArticle:1328196048335": {
        "name": "Runner Connie Grant Signs Endorsement Deal with Maverick USA",
        "parents": [
          {
            "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351718403",
            "rel": "assetReference",
            "templated": false,
            "mediaType": "",
            "method": "GET",
            "profile": ""
          }
        ]
      },
      "metadata": {
        "confidence": 90,
        "rating": 50
      },
      "start": "AVIArticle:1328196048335"
    },
    {
      "metadata": {
        "confidence": 80,
        "rating": 50
      },
      "AVIArticle:1363104085499": {
        "name": "3 Surprising Ways to Enjoy Treadmill Running",
        "parents": [
          {
            "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351718403",
            "rel": "assetReference",
            "templated": false,
            "mediaType": "",
            "method": "GET",
            "profile": ""
          }
        ]
      },
      "start": "AVIArticle:1363104085499"
    }
  ]
}

Example 2

The following example shows how to get the second 2 recommended AVIArticle names and IDs for Male in Running Recommendation in the avisports sample site in WebCenter Sites, by submitting a GET request on the REST resource using cURL.

The REST URL also specifies to give only the next link.

Query param details:

  • "segments=Male": Need only Male recommended assets.

  • "offset=2&limit=2": The second 2 results, so it starts with offset 2.

  • "assetDepth=0&fields=name,id&expand=AVIArticle": All recommendation assets (AVIArticles) are available in an 'items' array. Each item (AVIArticle) is an aggregated asset, and so it is the root asset for that item. We are only interested in thename,id values of that root asset, AVIArticle.

  • "links=next": Show only the next link.

curl -i -H "Accept: application/json" -X GET "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/engage/recommendation/Running%20Recommendation/items?segments=Male&offset=2&limit=2&assetDepth=0&fields=name,id&expand=AVIArticle&links=next"

Example 2 Response Header

The following example shows the response header.

HTTP/1.1 200 OK
ETag: "0ca74042d77c17a854ff9fcde80c7fb41deeca7e5c443822ac8e14b0e2253759"
Cache-Control: max-age=0
Content-Type: application/json;charset=utf-8

Example 2 Response Body

The following example shows the contents of the response body, in JSON format.

{
  "offset": 2,
  "limit": 8,
  "count": 2,
  "hasMore": true,
  "links": [
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/engage/recommendation/Running%20Recommendation/items?expand=AVIArticle&offset=4&limit=2&links=next&fields=name,id&assetDepth=0&segments=Male",
      "rel": "next",
      "templated": false,
      "mediaType": "",
      "method": "",
      "profile": ""
    }
  ],
  "items": [
    {
      "metadata": {
        "confidence": 80,
        "rating": 50
      },
      "AVIArticle:1363104043066": {
        "name": "England Tries to Capitalize on Its Running Fame",
        "id": 1363104043066,
        "parents": [
          {
            "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351718403",
            "rel": "assetReference",
            "templated": false,
            "mediaType": "",
            "method": "GET",
            "profile": ""
          }
        ]
      },
      "start": "AVIArticle:1363104043066"
    },
    {
      "AVIArticle:1363104016159": {
        "name": "Male Guide To Running Faster",
        "id": 1363104016159,
        "parents": [
          {
            "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351718403",
            "rel": "assetReference",
            "templated": false,
            "mediaType": "",
            "method": "GET",
            "profile": ""
          }
        ]
      },
      "metadata": {
        "confidence": 80,
        "rating": 50
      },
      "start": "AVIArticle:1363104016159"
    }
  ]
}